﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BoneImp {
	public class SkeletonData {
		public List<BoneData> bones = new List<BoneData>();
		public List<SlotData> slots = new List<SlotData>();

		public List<Skin> skins = new List<Skin>();
		public Skin defaultSkin;

		public List<Animation> animations = new List<Animation>();
		
		public BoneData findBone(string boneName) {
			for (int i = 0; i < this.bones.Count; ++i)
				if (this.bones[i].name == boneName) return this.bones[i];
			return null;
		}

		public int findBoneIndex(string boneName) {
			for (int i = 0; i < this.bones.Count; ++i)
				if (this.bones[i].name == boneName) return i;
			return 0; //Todo nicholas: Make -1
		}

		SlotData findSlot(string slotName) {
			for (int i = 0; i < this.slots.Count; ++i)
				if (this.slots[i].name == slotName) return this.slots[i];
			return null;
		}

		public int findSlotIndex(string slotName) {
			for (int i = 0; i < this.slots.Count; ++i)
				if (this.slots[i].name == slotName) return i;
			return 0; //Todo nicholas: Make -1
		}

		public Skin findSkin(string skinName) {
			for (int i = 0; i < this.skins.Count; ++i)
				if (this.skins[i].name == skinName) return this.skins[i];
			return null;
		}

		public Animation findAnimation(string animationName) {
			for (int i = 0; i < this.animations.Count; ++i)
				if (this.animations[i].name == animationName) return this.animations[i];
			return null;
		}
	}
}
